package com.tjsinfo.tjsoa.addresslist.action;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;

import com.tjsinfo.tjsoa.Dao.IQbcDao;
import com.tjsinfo.tjsoa.addresslist.vo.AddressListSystemUser;
import com.tjsinfo.tjsoa.addresslist.vo.AddressListUser;

public class YifabuListAction extends Action{
	private IQbcDao qbcDao;

	public IQbcDao getQbcDao() {
		return qbcDao;
	}

	public void setQbcDao(IQbcDao qbcDao) {
		this.qbcDao = qbcDao;
	}

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		
		DetachedCriteria criteria = DetachedCriteria.forClass(AddressListSystemUser.class);
		criteria.add(Restrictions.eq("remarks", "是"));
		criteria.addOrder(Order.asc("userId"));
		
		List list = (ArrayList)qbcDao.getCriteria(criteria);
		request.setAttribute("list", list);
		
		return mapping.findForward("ok");
	}
}